package com.aaa.service.jl.impl;

import com.aaa.dao.jl.QuestionSasDao;
import com.aaa.pojo.jl.QusetionSas;
import com.aaa.service.jl.QuestionSasService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class QuestionSasServiceImpl implements QuestionSasService {
    @Autowired
    private QuestionSasDao questionSasDao;


    @Override
    public List<QusetionSas> findAll(String page, String limit) {
        int pageInt = Integer.parseInt(page);
        int limitInt = Integer.parseInt(limit);
        int start = (pageInt - 1) * limitInt;
        List<QusetionSas> all = questionSasDao.findAll(start, limitInt);
        return all;
    }

    @Override
    public int findCount() {
        int count = questionSasDao.findCount();
        return count;
    }

    @Override
    public List<QusetionSas> findAll1() {
        List<QusetionSas> all1 = questionSasDao.findAll1();
        return all1;
    }

    @Override
    public int insert(QusetionSas qusetionSas) {
        return questionSasDao.insert(qusetionSas);
    }

    @Override
    public int update(QusetionSas qusetionSas) {
        return questionSasDao.update(qusetionSas);
    }

    @Override
    public int deleteById(String idList) {

        return questionSasDao.deleteById(Integer.parseInt(idList));
    }



    @Override
    public List<QusetionSas> fuzzyQuestion(String question) {

        return questionSasDao.fuzzyQuestion(question);

    }
    @Override
    public List<QusetionSas> fuzzyCreateBy(String createBy) {

        return questionSasDao.fuzzyCreateBy(createBy);
    }


    @Override
    public List<QusetionSas> fuzzyQuestionAndCreatBy(String question, String createBy,String page ,String limit) {
        int pageInt = Integer.parseInt(page);
        int limitInt = Integer.parseInt(limit);
        int start = (pageInt - 1) * limitInt;
        return questionSasDao.fuzzyQuestionAndCreatBy(question,createBy,start, limitInt);
    }

    @Override
    public int deleteList(List<String> idList) {
        return questionSasDao.deleteList(idList);
    }

    @Override
    public int queryCountLike(String question, String createBy) {
        return questionSasDao.queryCountLike(question,createBy);
    }

    @Override
    public List<QusetionSas> findAllQusertion() {
        return questionSasDao.findAllQusertion();
    }

}
